﻿<%@ Page Title="" Language="C#" MasterPageFile="../Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<SailHero.Soft.FrameWork.Models.SYS_SOFTAUTHKEY>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    验证许可文件的合法性
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="head" runat="server">
    <script src="<%=Page.ResolveUrl("../../Scripts/jquery.ajaxfileupload.js")%>" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $("#cancel").click(function () {
                window.location = "/Auth/index";
            });
        });


        $(function () {
            $('#fileToUpload').change(function () {
                ajaxFileUpload();
            });
        });

        function ajaxFileUpload() {
            $("#loading")
                .ajaxStart(function () {
                    $(this).show();
                })
                .ajaxComplete(function () {
                    $(this).hide();
                });
            $.ajaxFileUpload({
                url: '/Auth/UploadSkey',
                secureuri: false,
                fileElementId: 'fileToUpload',
                dataType: 'json',
                success: function (data) {
                    ShowData(data);
                },
                error: function (data) {
                    ShowData(data);
                }
            });
            $('#fileToUpload').change(function () {
                ajaxFileUpload();

            });
        }

        function ShowData(data) {
            if (data.status == "error") {
                $("#status").html("验证失败：" + data.msg);
                $("#SoftNo").val("");
                $("#SoftVersion").val("");
                $("#MachineCode").text("");
                $("#CPUID").val("");
                $("#MAC").val("");
                $("#SoftCName").html("");
                $("#SoftID").val("");
            }
            else {
                $("#status").html(data.msg);
                $("#SoftNo").val(data.ProductId);
                $("#SoftVersion").val(data.Version);
                $("#MachineCode").text(data.MachinCode);
                $("#CPUID").val(data.CPUID);
                $("#MAC").val(data.MAC);
                $("#SoftCName").html(data.SOFTCNAME);
                $("#SoftID").val(data.SoftID);
            }
        }

    </script>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="TabTitle" runat="server">
    验证许可文件的合法性
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div id="main_zone">
        <table width="99%" style="text-align: left;" border="0" align="center" cellpadding="3"
            cellspacing="1">
            <tr>
                <td width="18%" class="left_title_1">
                    请选择许可文件
                </td>
                <td width="32%" colspan="3">
                    <input id="fileToUpload" type="file" name="fileToUpload" style="width: 200px; height: 25px;" />
                    <span id="status" style="color: Red; margin-left:30px;"></span>
                    <img id="loading" src="<%=Page.ResolveUrl("../../Content/images/loading.gif")%>" style="display: none; height: 25px;
                        width: 25px;" />
                </td>
            </tr>
            <tr>
                <td width="18%" class="left_title_2">
                    软件名称
                </td>
                <td width="32%">
                    <span id="SoftCName"></span>
                    <%= Html.HiddenFor(mod => mod.SOFTID, new { @readonly = "readonly" })%>
                </td>
                <td width="18%" class="left_title_2">
                    软件标识编号
                </td>
                <td width="32%">
                    <%= Html.TextBoxFor(mod => mod.SOFTNO,new { @readonly = "readonly" })%>
                </td>
            </tr>
            <tr>
                <td class="left_title_1">
                    机器码
                </td>
                <td colspan="3">
                    <%= Html.TextAreaFor(mod => mod.MACHINECODE, new { style = "height:50px;width:750px;readonly:expression(this.readOnly=true);" })%>
                </td>
            </tr>
            <tr>
                <td class="left_title_2">
                    保留属性
                </td>
                <td>
                    
                </td>
                <td class="left_title_2">
                    软件版本
                </td>
                <td>
                    <%= Html.TextBoxFor(mod => mod.SOFTVERSION, new { @readonly = "readonly" })%>
                </td>
            </tr>
            <tr>
                <td class="left_title_1">
                    CPUID
                </td>
                <td>
                    <%= Html.TextBoxFor(mod => mod.CPUID, new { style = "width:350px;readonly:true;" })%>
                </td>
                <td class="left_title_1">
                    MAC
                </td>
                <td>
                    <%= Html.TextBoxFor(mod => mod.MAC, new { @readonly = "readonly" })%>
                </td>
            </tr>
            <tr>
                <td colspan="4" class="left_title_2" style="text-align: center;">
                    <input id="cancel" type="button" value="返回" />
                </td>
            </tr>
        </table>
    </div>
</asp:Content>
